<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <!-- Bootstrap CSS -->
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">

    <link rel="stylesheet" href="./css/catalog_1.css">
    <link rel="stylesheet" href="./css/style.css">
    <title>xxx商品目录</title>
</head>

<body>

<!--
    网站页眉,包含头部导航条
-->
<header>
    <!-- 网站头部导航条，固定在顶部,导航条样式为dark，背景为dark -->
    <nav class="navbar fixed-top navbar-light shadow-sm">
        <div class="container">
            <div class="input-group">
                <img src="./images/logo.jpg" height="40px" alt="">
                <input type="text" class="form-control" placeholder="霸王防脱" style="margin-left: 14%;">
                <div class="input-group-append" style="margin-right: 25%">
                    <button class="btn btn-outline-danger" type="button"><i class="fa fa-search"></i></button>
                </div>
            </div>
        </div>
    </nav>
</header>
<main>
    <section id="nav-section">
        <div class="container">
            <div id="logoImg" class="shadow-sm">
                <img src="./images/logo.png" width="190px;" alt="" />
            </div>
            <ul class="nav float-right py-1">
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">登录</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">|</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">注册</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">|</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">会员中心</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">|</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">购物指南</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">|</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">关于我们</a>
                </li>
            </ul>
        </div>
    </section>
    <section id="search-section">
        <div class="container py-4">
            <div class="row">
                <div class="input-group col-md-6 offset-md-3">
                    <input type="text" class="form-control" placeholder="霸王防脱">
                    <div class="input-group-append">
                        <button class="btn btn-outline-danger" type="button"><i class="fa fa-search"></i></button>
                    </div>
                </div>
                <div class="col-md-3">
                    <button type="button" class="btn btn-outline-danger px-5"><i class="fa fa-shopping-cart mr-1"></i>我的购物车</button>
                </div>
            </div>
        </div>
    </section>
    <section id="nav-list-section">
        <div class="container py-4">
            <div class="row">
                <ul class="nav col-md-9 offset-md-3">
                    <li class="nav-item">
                        <a class="nav-link text-secondary" href="#">|</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-dark" href="#">首页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-secondary" href="#">|</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-dark" href="#">定制套餐</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-secondary" href="#">|</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-dark" href="#">安全频道</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-secondary" href="#">|</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-dark" href="#">商城卡</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-secondary" href="#">|</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-dark" href="#">蔬菜基地</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-secondary" href="#">|</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-dark" href="#">节气养生</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-secondary" href="#">|</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-dark" href="#">便民服务</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link text-secondary" href="#">|</a>
                    </li>
                </ul>
            </div>
        </div>
    </section>


        <section class="content">
            <div class=" container">
            <div class="row">
            	<div class="col-sm-3 col-xm-3">
                    <div id ="catelog_child list-group">
                        <a href="#" class="list-group-item ">春衣</a>
                        <a href="#" class="list-group-item ">秋裤</a>
                        <a href="#" class="list-group-item list-group-item-success">
                        </a>
                        <a href="#" class="list-group-item ">冬羽绒服</a>
                    </div>
				</div>
                <div class="col-sm-9 col-xm-9">
                    <h2 class="text-center py-5">--热门商品--</h2>
                    <div class="container">
                        <div id="foods" class="row">

                        </div>
                    </div>
                </div>
            </div>
            </div> 
        </section>


    <footer>
        <div class="container">
            <ul class="nav col-md-8 offset-md-2 pt-3">
                <li class="nav-item">
                    <a class="nav-link text-dark" href="#">关于我们</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">|</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-dark" href="#">联系我们</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">|</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-dark" href="#">招贤纳士</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">|</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-dark" href="#">法律声明</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">|</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-dark" href="#">友情链接</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">|</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-dark" href="#">支付方式</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">|</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-dark" href="#">配送方式</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">|</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-dark" href="#">服务声明</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-secondary" href="#">|</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link text-dark" href="#">广告声明</a>
                </li>
            </ul>
        </div>
        <div class="text-center py-3">Copyright © 2018-2019 网上商城 版权所有</div>
    </footer>
</body>
<script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
		$.ajax({
	        url: '/eshop-project/Commodity/loadAll',
	        type: 'POST',
	        cache: false,
	        processData: false,
	        contentType: false,
	        dataType: "json",
		    }).done(function(res){
		    	console.log(res);
		    	var position = document.getElementById('foods');
		    	var div = "";
		    	for(var i=0;i<res.length;i++){
		    		div =
		    		'<div class="col-md-4 col-sm-6">'+
		    			'<div class="card mb-4">'+
                            '<a href="#">'+
                                '<img class="card-img-top" src="images/product/1 .jpg" data-holder-rendered="true">'+
                            '</a>'+
                            '<div class="card-body text-center">'+
                                '<h5 class="text-muted"><a href="#">'+res[i].name+'</a></h5>'+
                                '<p class="text-danger">'+res[i].commercialPrice+'</p>'+
                            '</div>'+
                        '</div>'+
                    '</div>';
                    $("#foods").append(div);
		    	}
		    	
		    }).fail(function(res){
		        alert("初始化商品列表失败");
		});
</script>
        <script>
        $(function(){
            $(".panel-heading").click(function(e){
                /*切换折叠指示图标*/
                $(this).find("span").toggleClass("glyphicon-chevron-down");
                $(this).find("span").toggleClass("glyphicon-chevron-up");
            });
        });
        </script>
</html>